﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using MarketMS;
using Moned;

namespace Dll
{
    public class goodssql
    {
        static    DBHelper db = null;
            public goodssql()
            {
                db = new SqlServerDBHelper();
            }

        public Foodsinfo jeizhang(string code)
        {

            Foodsinfo  s = new Foodsinfo();
            string sql ="select * from GoodsInfo where GoodsCode like '%"+code+"%'";
            DbDataReader dr = db.GetReader(sql);
            if (dr.Read())
            {
                s.GoodsCode = dr["GoodsCode"].ToString();
                s.GoodsName = dr["GoodsName"].ToString();
                s.OriginPrice = Convert.ToInt32(dr["OriginPrice"]);
                s.SalePrice = Convert.ToInt32(dr["SalePrice"]);
                s.Stock = dr["Stock"].ToString();
                s.Unit = dr["Unit"].ToString();
                s.GoodsState = Convert.ToInt32(dr["GoodsState"]); 
           }
            dr.Close();
            db.Close();
            return s;
 
        }
    }
}
